#ifndef __U2StaticPluginLoader_H__
#define __U2StaticPluginLoader_H__


#include "U2PreRequest.h"
#include "U2Root.h"

#ifdef U2_STATIC_GLES
#  include "U2GLESPlugin.h"
#endif


U2EG_NAMESPACE_BEGIN


/** Utility class for loading some plugins statically.
@remarks
    When loading plugins statically, you are limited to loading plugins 
    that are known about at compile time. You should define preprocessor
    symbols depending on which plugins you want to load - the symbol being
    U2_STATIC_<pluginname>, with pluginname being the usual name of the
    plugin DLL (no file extension, no debug suffix, and without the Plugin_ 
    or RenderSystem_ prefix.)
*/
class StaticPluginLoader
{
protected:
#ifdef U2_STATIC_GLES
    U2GLESPlugin* mGLESPlugin;
#endif
    
public:
    StaticPluginLoader() {}

    /** Load all the enabled plugins against the passed in root object. */
    void load()
    {
        U2Root& root  = U2Root::getSingleton();
        
#ifdef U2_STATIC_GLES
        mGLESPlugin = U2_NEW U2GLESPlugin();
        root.installPlugin(mGLESPlugin);
#endif
    }

    void unload()
    {
        // don't unload plugins, since Root will have done that. Destroy here.
#ifdef U2_STATIC_GLES
        U2_DELETE mGLESPlugin;
#endif

    }

};


U2EG_NAMESPACE_END


#endif
